<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	ArrayList<String> jsPaths = (ArrayList<String>) request
			.getAttribute("jsPaths");
	jsPaths.add("/resources/bootstrap/table/jquery.dataTables.min.js");
	jsPaths.add("/resources/bootstrap/table/dataTables.bootstrap.js");
	jsPaths.add("/resources/bootstrap/select/bootstrap-select.js");
	jsPaths.add("/resources/custom/project/project.js");
%>
<div class="panel-group" id="accordion">
	<div class="panel panel-default">
		<div class="panel-heading">
			<h4 class="panel-title">
				<div data-toggle="collapse" data-toggle="collapse"
					data-parent="#accordion" href="#collapseOne"
					style="cursor: pointer;">
					<img alt=""
						src="${pageContext.request.contextPath}/resources/bootstrap/custom/search.png">
					&nbsp;搜索项目<span class="glyphicon glyphicon-chevron-down pull-right"
						id="arrow"></span>
				</div>
			</h4>
		</div>
		<div id="collapseOne" class="panel-collapse collapse">
			<div class="panel-body">
				<form role="form">
					<div class="row">
						<div class="form-group col-sm-4">
							<label for="searchName" class="col-sm-3 control-label">名称:</label>
							<div class="col-sm-9">
								<input name="searchName" id="searchName" placeholder="名称"
									class="form-control">
							</div>
						</div>
						<div class="form-group col-sm-4">
							<label for="searchProvince" class="col-sm-3 control-label">省:</label>
							<div class="col-sm-9">
								<select name="province" id="searchProvince"
									class="selectpicker form-control" data-live-search="true"><option>请选择省份</option></select>
							</div>
						</div>
						<div class="form-group col-sm-4">
							<label for="searchCity" class="col-sm-3 control-label">市:</label>
							<div class="col-sm-9">
								<select name="city" id="searchCity"
									class="selectpicker form-control" data-live-search="true"><option>请选择市</option></select>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="form-group col-sm-4">
							<label for="searchDistrict" class="col-sm-3 control-label">区:</label>
							<div class="col-sm-9">
								<select name="district" id="searchDistrict"
									class="selectpicker form-control" data-live-search="true"><option>请选择区县</option></select>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<button class="btn btn-success btn-sm" data-toggle="modal"
	data-target="#myModal" id="addProject">添加项目</button>
<div class="table-responsive">
	<table id="project"
		class="table table-striped table-bordered table-hover display"
		cellspacing="0" width="100%">
		<thead>
			<tr>
				<th>名称</th>
				<th>描述</th>
				<th>省</th>
				<th>市</th>
				<th>区</th>
				<th>费率（元）</th>
				<th>操作</th>
			</tr>
		</thead>
	</table>
</div>

<!-- add project dialog -->
<div class="modal fade" id="createProjectModal" tabindex="-1"
	role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">项目</h4>
			</div>

			<form id="addForm" class="form-horizontal" role="form"
				action="${pageContext.request.contextPath}/project/create"
				method="post">
				<div class="modal-body">
					<div class="form-group">
						<label for="name" class="col-sm-3 control-label">名称</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="name" name="name"
								placeholder="名称">
						</div>
					</div>
					<div class="form-group">
						<label for="Province" class="col-sm-3 control-label">省</label>
						<div class="col-sm-9">
							<select class="selectpicker form-control province" id="province"
								data-live-search="true" name="province" title='select'></select>
						</div>
					</div>
					<div class="form-group">
						<label for="city" class="col-sm-3 control-label">市</label>
						<div class="col-sm-9">
							<select class="selectpicker form-control city" id="city"
								name="city" data-live-search="true" title='select'></select>
						</div>
					</div>
					<div class="form-group">
						<label for="district" class="col-sm-3 control-label">区</label>
						<div class="col-sm-9">
							<select class="selectpicker form-control district" id="district"
								data-live-search="true" name="district" title='select'></select>
						</div>
					</div>
					<div class="form-group">
						<label for="rate" class="col-sm-3 control-label">费率（元）</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="rate" name="rate"
								placeholder="费率">
						</div>
					</div>
					<div class="form-group">
						<label for="description" class="col-sm-3 control-label">描述</label>
						<div class="col-sm-9">
							<textarea type="text" class="form-control" id="description"
								name="description" placeholder="描述"></textarea>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="submit" class="btn btn-primary" id="create">创建项目</button>
				</div>
			</form>
		</div>
	</div>
</div>
<!-- edit user dialog -->
<div class="modal fade" id="editProjectModal" tabindex="-1"
	role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">编辑项目</h4>
			</div>

			<form id="editForm" class="form-horizontal" role="form"
				action="${pageContext.request.contextPath}/project/update"
				method="post">
				<div class="modal-body">
					<input type="hidden" id="idEdit" name="id">
					<div class="form-group">
						<label for="name" class="col-sm-3 control-label">名称</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="nameEdit" name="name"
								placeholder="名称">
						</div>
					</div>
					<div class="form-group">
						<label for="Province" class="col-sm-3 control-label ">省</label>
						<div class="col-sm-9">
							<select class="selectpicker form-control province"
								id="provinceEdit" data-live-search="true" name="province"
								title='select'></select>
						</div>
					</div>
					<div class="form-group">
						<label for="city" class="col-sm-3 control-label">市</label>
						<div class="col-sm-9">
							<select class="selectpicker form-control city" id="cityEdit"
								name="city" data-live-search="true" title='select'></select>
						</div>
					</div>
					<div class="form-group">
						<label for="district" class="col-sm-3 control-label">区</label>
						<div class="col-sm-9">
							<select class="selectpicker form-control district"
								id="districtEdit" data-live-search="true" name="district"
								title='select'></select>
						</div>
					</div>
					<div class="form-group">
						<label for="rateEdit" class="col-sm-3 control-label">费率（元）</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="rateEdit" name="rate"
								placeholder="费率">
						</div>
					</div>
					<div class="form-group">
						<label for="description" class="col-sm-3 control-label">描述</label>
						<div class="col-sm-9">
							<textarea type="text" class="form-control" id="descriptionEdit"
								name="description" placeholder="描述"></textarea>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="submit" class="btn btn-primary">更新</button>
				</div>
			</form>
		</div>
	</div>
</div>
<!-- delete user dialog -->
<div class="modal fade" id="deleteProjectModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title">删除项目</h4>
			</div>
			<div class="modal-body">
				<p>确定永久删除该条记录吗？</p>
			</div>
			<form class="form-horizontal" role="form"
				action="${pageContext.request.contextPath}/project/delete"
				method="post">
				<input type="hidden" class="form-control" id="idDelete" name="id">

				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="submit" class="btn btn-primary">删除</button>
				</div>
			</form>
		</div>
	</div>
</div>